#!/bin/sh
cd "${0%/*}" || exit                                # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions        # Tutorial run functions
#------------------------------------------------------------------------------

mkdir -p constant/triSurface

# copy motorbike surface from resources directory
cp -f $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/

runApplication surfaceFeatureExtract

runApplication blockMesh

# Serial
# ------
#runApplication snappyHexMesh -overwrite
#rm -f constant/polyMesh/refinementHistory*
# - set the initial fields
# restore0Dir
#runApplication setFields

# Parallel
# --------
runApplication decomposePar -force
runParallel snappyHexMesh -overwrite
ls -d processor* | xargs -I {} rm -f ./{}/constant/polyMesh/refinementHistory

# - set the initial fields
restore0Dir -processor

runParallel setFields

#------------------------------------------------------------------------------
